from rest_framework.permissions import BasePermission
from authDemo import models


class MyPermission(BasePermission):
    message = {'code': 10001, 'error': '你没有权限'}

    def has_permission(self, request, view):
        if request.user:
            return True
        return False
        # if models.UserInfo.objects.first().token == request.query_params.get('token'):
        #     return True
        # return False

    def has_object_permission(self, request, view, obj):
        return False
